package main

import "fmt"

type Stu struct {
	Name string
	Age  int
}

func main() {

	//方式一
	//创建结构体变量是，就直接指定字段的值
	var stu1 = Stu{"小明", 18}

	stu2 := Stu{"小刚", 20}

	//在创建结构体变量时，吧字段名和字段值写在一起
	var stu3 = Stu{
		Age:  18,
		Name: "light",
	}
	stu4 := Stu{
		Age:  24,
		Name: "iron",
	}
	fmt.Println(stu1, stu2, stu3, stu4)

	//方式二
	//返回结构体的指针类型
	var stu5 *Stu = &Stu{"小王", 29}
	stu6 := &Stu{"小红", 39}
	var stu7 = &Stu{
		Name: "小葵",
		Age:  33,
	}
	stu8 := &Stu{
		Age:  33,
		Name: "小葵",
	}
	fmt.Println(*stu5, *stu6, *stu7, *stu8)
}
